<?php

namespace App\Http\Middleware;

use Closure;

class CheckApi
{
    private $whiteList = [
        'api/web/index'
    ];

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next) {

        $currentUrl = $request->path();
        //不在白名单且缺少 token的
        if(!in_array($currentUrl,$this->whiteList) && !$request->hasHeader('token')){
            //return responseFail('缺少token！');
        }
        return $next($request);
    }
}
